﻿#region Copyright Notice
// 
// 
// Copyright (c) 2009-2010 Anindya Chatterjee
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
//     http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// 
// 
// 
#endregion
using System.Drawing;
using System.Windows.Forms;
using DigitalRune.Windows.Docking;

namespace Event.Plugin.Utility
{
    /// <summary>
    /// Base class to create the NotifyTip window
    /// </summary>
    public partial class BaseNotifyTip : DockableForm
    {
        private Icon _tipIcon;

        /// <summary>
        /// Initializes a new instance of the <see cref="BaseNotifyTip"/> class.
        /// </summary>
        public BaseNotifyTip(AbstractEvent sender)
        {
            InitializeComponent();
            CheckForIllegalCrossThreadCalls = false;
            Event = sender;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="BaseNotifyTip"/> class.
        /// </summary>
        protected BaseNotifyTip()
        {
            InitializeComponent();
        }

        /// <summary>
        /// Notify tip heading text
        /// </summary>
        public string TipHeading { get; set; }

        /// <summary>
        /// Notify tip body text
        /// </summary>
        public string TipText { get; set; }

        /// <summary>
        /// Notify tip icon
        /// </summary>
        public Icon TipIcon
        {
            get { return _tipIcon; }
            set
            {
                _tipIcon = value;
                Icon = value;
            }
        }

        ///<summary>
        /// The Event object attached to this NotifyTip
        ///</summary>
        public AbstractEvent Event { get; set; }

        /// <summary>
        /// The host of this form
        /// </summary>
        public Form Host { get; set; }

        /// <summary>
        /// Updates this existing notifytip with the supplied tip.
        /// </summary>
        /// <param name="tip">The tip.</param>
        /// <remarks>This methods can be used for the looping events where the notification message is
        /// always changing.</remarks>
        public virtual void Update(BaseNotifyTip tip)
        {
            Event = tip.Event;
            Host = tip.Host;
            TipIcon = tip.TipIcon;
        }
    }
}